package tests;


import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import business.Aluno;
import business.CalendarDate;
import business.Curso;
import business.Disciplina;
import business.Pessoa;
import business.Professor;
import business.Professor.Categoria;
import business.Professor.GrauAcademico;
import business.Seccao;

public class ProfessorTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}
	
	@Test
	public void validConstruct(){
		Professor p = new Professor("John Doe", new CalendarDate(11,11,2000), "john@doe.com", GrauAcademico.doutor, Categoria.assistente, 55, "D356", new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest1(){
		Professor p = new Professor(null,new CalendarDate(1,1,1989),"john@doe.com",GrauAcademico.doutor,Categoria.profAssociado,35,"d33",new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest2(){
		Professor p = new Professor("john doe",null,"john@doe.com",GrauAcademico.doutor,Categoria.profAssociado,35,"d33",new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest3(){
		Professor p = new Professor("john doe",new CalendarDate(1,1,1989),null,GrauAcademico.doutor,Categoria.profAssociado,35,"d33",new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest4(){
		Professor p = new Professor("john doe",new CalendarDate(1,1,1989),"john@doe.com",null,Categoria.profAssociado,35,"d33",new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest5(){
		Professor p = new Professor("john doe",new CalendarDate(1,1,1989),"john@doe.com",GrauAcademico.doutor,null,35,"d33",new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest6(){
		Professor p = new Professor("john doe",new CalendarDate(1,1,1989),"john@doe.com",GrauAcademico.doutor,Categoria.profAssociado,-1,"d33",new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest7(){
		Professor p = new Professor("john doe",new CalendarDate(1,1,1989),"john@doe.com",GrauAcademico.doutor,Categoria.profAssociado,35,null,new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void constructAssertionTest8(){
		Professor p = new Professor("john doe",new CalendarDate(1,1,1989),"john@doe.com",GrauAcademico.doutor,Categoria.profAssociado,35,"d33",null);
	}
	
//	@Test
//	public void invalidConstruct(){
//		Professor p = new Professor(null,null,null,null,null, -1, null, null);
//	}
//	
//	public void invalidConstruct2(){
//		Professor p = new Professor("John Doe", new CalendarDate(), "john@doe.com", GrauAcademico.doutor, Categoria.assistente, 55, "D356", new Seccao());
//	}
	
	@Test
	public void validSetName(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setNome("John Doe");
	}

//	@Test
//	public void invalidSetName(){
//		Professor p = new Professor();
//		p.setDataNascimento(new CalendarDate(10,10,1990));
//		p.setNome(null);
//	}
//	
	@Test
	public void validSetDate(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(11,11,2000));
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetDate(){
		Professor p = new Professor();
		p.setDataNascimento(null);
	}
	
	@Test 
	public void setDateTester(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate());
	}
	
	@Test
	public void validSetEmail(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setEmail("john@doe.com");
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetEmail(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setEmail(null);
	}
	
	@Test
	public void validSetGA(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setGrau(GrauAcademico.licenciado);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetGA(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setGrau(null);
	}
	
	@Test
	public void validSetCategoria(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setNivel(Categoria.assistente);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetCategoria(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setNivel(null);
	}
	
	@Test
	public void validSetExtensao(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setExtensao(55);
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetExtensao(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setExtensao(-1);
	}
	
	@Test
	public void validSetGabinete(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setGabinete("D555");
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetGabinete(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setGabinete(null);
	}
	
	@Test
	public void validSetSeccao(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setSeccao(new Seccao());
	}
	
	@Test (expected=AssertionError.class)
	public void invalidSetSeccao(){
		Professor p = new Professor();
		p.setDataNascimento(new CalendarDate(10,10,1990));
		p.setSeccao(null);
	}
	
	@Test
	public void regidasTest(){
		Professor p = new Professor();
		Disciplina d = new Disciplina();
		d.setRegente(p);
		p.regidas();
	}
	
	@Test
	public void objectTest(){
		Professor.objectos();
	}
	
	@Test
	public void resetTest(){
		Professor.reset();
	}
	
	@Test
	public void leccionadasTest(){
		Disciplina d = new Disciplina();
		Professor p = new Professor();
		d.addEquipaDocente(p);
		p.leccionadas();
	}
	
	@Test
	public void ccTest(){
		Curso c = new Curso();
		Professor p = new Professor();
		c.addComissaoCientifica(p);
		p.curso_cc();
	}
	
	@Test
	public void coordenadorTest(){
		Curso c = new Curso();
		Professor p = new Professor();
		c.setCoordenador(p);
		p.curso_c();
	}
	
	@Test
	public void coordenadorErasmusTest(){
		Curso c = new Curso();
		Professor p = new Professor();
		c.setCoordenadorErasmus(p);
		p.curso_ce();
	}
	
	@Test
	public void getterTester(){
		Professor p = new Professor();
		p.getClass();
		p.getDataNascimento();
		p.getEmail();
		p.getExtensao();
		p.getGabinete();
		p.getGrau();
		p.getNivel();
		p.getNome();
		p.getSeccao();
	}
	
	@Test
	public void lancaResultadoTester(){
		Professor p = new Professor();
		p.lancaResultado(new Disciplina(), new Aluno(), 10);
	}
	
	@Test (expected=AssertionError.class)
	public void lancaResultadoAssertionTester1(){
		Professor p = new Professor();
		p.lancaResultado(null, new Aluno(), 10);
	}
	
	@Test (expected=AssertionError.class)
	public void lancaResultadoAssertionTester2(){
		Professor p = new Professor();
		p.lancaResultado(new Disciplina(), null, 10);
	}
	
	@Test (expected=AssertionError.class)
	public void lancaResultadoAssertionTester3(){
		Professor p = new Professor();
		p.lancaResultado(new Disciplina(), new Aluno(), -1);
	}
	
	@Test
	public void toStringTest(){
		Professor p = new Professor();
		p.setNome("john doe");
		p.setDataNascimento(new CalendarDate());
		p.setEmail("john@doe.com");
		p.setExtensao(35);
		p.setGabinete("d33");
		p.setGrau(GrauAcademico.agregado);
		p.setNivel(Categoria.assistente);
		p.setSeccao(new Seccao());
		p.toString();
	}
	
	
}
